package net.jonbuck.tassoo.ui.view;

import net.jonbuck.tassoo.ui.view.page.DefaultPage;
import net.jonbuck.tassoo.ui.view.page.TaskViewPage;

import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.part.IPage;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.part.PageBookView;

/**
 * 
 * 
 * @since 1.0.0
 */
public class DetailsView extends PageBookView {

	/**
	 * 
	 */
	public DetailsView() {
		super();
	}

	/**
	 * 
	 */
	protected IPage createDefaultPage(PageBook book) {
		DefaultPage page = new DefaultPage();
		initPage(page);
		page.createControl(book);
		return page;
	}

	/**
	 * 
	 */
	protected PageRec doCreatePage(IWorkbenchPart part) {
		if (part instanceof TasksView) {
			TaskViewPage taskViewPage = new TaskViewPage();
			initPage(taskViewPage);
			taskViewPage.createControl(getPageBook());
			return new PageRec(part, taskViewPage);
		}
		return null;
	}

	/**
	 * 
	 */
	protected void doDestroyPage(IWorkbenchPart part, PageRec rec) {
		IPage page = rec.page;
		page.dispose();
		rec.dispose();
	}

	/**
	 * 
	 */
	protected IWorkbenchPart getBootstrapPart() {
		return null;
	}

	/**
	 * 
	 */
	protected boolean isImportant(IWorkbenchPart part) {
		if (part == this) {
			return false;
		}
		return true;
	}

}
